<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>
<head>
    <meta charset="utf-8"/>
    <title>文章编辑页</title>
    <meta name="keywords" content="设置关键词..."/>
    <meta name="description" content="设置描述..."/>
    <meta name="author" content="DeathGhost"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <link rel="icon" href="/content/icon/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="/js/jquery.js"></script>
    <script src="/js/public.js"></script>
    <script src="/js/jquery-form.js"></script>
    <script src="/js/plug-ins/pagination.js"></script>

    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <script charset="utf-8" src="/editor/kindeditor.js"></script>
    <script charset="utf-8" src="/editor/lang/zh-CN.js"></script>
    <script language="javascript" type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
    <script>
        KindEditor.ready(function(K) {
            window.editor = K.create('#editor_id', {
                uploadJson : '/editor/jsp/upload_json.jsp',
                fileManagerJson : '/editor/jsp/file_manager_json.jsp',
                allowFileManager : true
            });

            $(".pagination").createPage({
                pageCount:${articleListCount},
                current:${page},
                backFn:function(p){
                    var form = $('<form action="/admin/articleList" method="post" target="_self"></form>');
                    $(document.body).append(form);
                    form.append($('<input type="text" name="page" />').attr('value', p));
                    // 提交表单
                    form.submit();
                }
            });
        });
        
        function deleteArticle(id) {
            var form = $('<form action="/admin/deleteArticle" method="post" target="_self"></form>');
            $(document.body).append(form);
            form.append($('<input type="text" name="id" />').attr('value', id));
            form.append($('<input type="text" name="page" />').attr('value', ${page}));
            // 提交表单
            form.submit();
        }

        function articleInfo(id) {
            var form = $('<form action="/admin/articleInfo" method="post" target="_self"></form>');
            $(document.body).append(form);
            form.append($('<input type="text" name="id" />').attr('value', id));
            form.submit();
        }
    </script>
</head>
<body>
<c:import url="menu.jsp"></c:import>
<main class="main-cont content mCustomScrollbar">
    <!--开始::内容-->
    <div class="page-wrap">
        <section class="page-hd">
            <header>
                <h2 class="title"><i class="icon-home"></i>文章编辑页</h2>
                <p class="title-description">
                    页面说明
                </p>
            </header>
            <hr>
        </section>

        <div class="content-wrap">
            <header class="top-hd">
                <div class="hd-lt">
                    <a class="icon-reorder"></a>
                </div>
                <div class="hd-rt">
                    <ul>
                        <li>
                            <a href="#" target="_blank"><i class="icon-home"></i>前台访问</a>
                        </li>
                        <li>
                            <a><i class="icon-random"></i>清除缓存</a>
                        </li>
                        <li>
                            <a><i class="icon-user"></i>管理员:<em>DeathGhost</em></a>
                        </li>
                        <li>
                            <a><i class="icon-bell-alt"></i>系统消息</a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" id="JsSignOut"><i class="icon-signout"></i>安全退出</a>
                        </li>
                    </ul>
                </div>
            </header>
            <main class="main-cont content mCustomScrollbar">
                <div class="page-wrap">
                    <!--开始::内容-->
                    <table class="table table-bordered table-striped table-hover">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>标题</th>
                            <th>图片</th>
                            <th>创建日期</th>
                            <th>结束日期</th>
                            <th>类型</th>
                            <th>关联微信</th>
                            <th>阅读数</th>
                            <th>点赞数</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${articleList}" var="article" varStatus="vs">
                        <tr class="cen">
                            <td>${article.id}</td>
                            <td>${article.title}</td>
                            <td><img src="http://or5mz5dbj.bkt.clouddn.com/${article.img}" width="80px" height="80px" ></td>
                            <td>${article.createDateString} </td>
                            <td>${article.endDateString} </td>
                            <td>${article.typeString}</td>
                            <td>${article.wechatName}</td>
                            <td>${article.readNumber}</td>
                            <td>${article.goodNumber}</td>
                            <td>
                                <a title="编辑" class="mr-5" onclick="articleInfo(${article.id})">编辑</a>
                                <a title="删除" onclick="deleteArticle(${article.id})">删除</a>
                            </td>
                        </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="panel panel-default">
                        <div class="panel-bd">
                            <div class="pagination"></div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>



    </div>

</main>
<div class="mask"  id="mask"></div>
<div class="dialog Jmsg" id="error_dialog">
    <div class="dialog-hd">
        <strong class="lt-title">ERROR</strong>
        <a class="rt-operate icon-remove Jmsg" title="关闭"></a>
    </div>
    <div class="dialog-bd">
        <!--start::-->
        <p id="error_info"></p>
        <!--end::-->
    </div>
    <div class="dialog-ft">
        <button class="btn btn-info JyesBtn">确认</button>
        <button class="btn btn-secondary JnoBtn">关闭</button>
    </div>
</div>
<c:import url="footer.jsp"/>
